using System.Collections.Generic;
using System.Linq;

namespace CapstoneMockup.Data
{
    public class ExpenseLog
    {
        public string _nameOfLog;
        public List<Expense> _ListOfExpenses { get; private set; }
        public double _totalAmount
        {
            get
            {
                if (_ListOfExpenses.Count > 0)
                    return _ListOfExpenses.Sum(ex => ex.Amount);
                return 0;
            }
            private set { _totalAmount = value; } 
        }

        public ExpenseLog(string nameOfLog)
        {
            _nameOfLog = nameOfLog;
            _ListOfExpenses = new List<Expense>();
        }

        public void AddExpenseToList(string description, double amount, string accountNum = "", string placeOfPurchase = "")
        {
            _ListOfExpenses.Add(new Expense(description, amount, accountNum, placeOfPurchase));
        }

        public override string ToString()
        {
            return _nameOfLog + ".log";
        }


        
    }
}
